/**
 * @author LKQ
 * @date 2021/12/23 20:04
 * @description
 */
public class FormalSolution3 {
    public static void main(String[] args) {

    }

    public ListNode reverseList(ListNode head) {
        ListNode ans = null;
        while (head != null) {
            ans = new ListNode(head.val, ans);
            head = head.next;
        }
        return ans;
    }
}
